package util;

import javax.servlet.http.HttpServletRequest;

/**
 *
 * @author Jeroen
 */
public class Toolkit {

    public static boolean checkLogin(HttpServletRequest request) {
        boolean isLoggedIn = false;
        try {
            String username = (String) request.getSession().getAttribute("user");
            if (username == null || username.equals("")) { // Ogenschijnlijk is de gebruiker niet ingelogd
                isLoggedIn = false;
            } else {
                isLoggedIn = true;
            }
        } catch (NullPointerException e) {
            isLoggedIn = false;
        }
        return isLoggedIn;
    }
}